package com.ftg.learn.chapter01;

/**
 * 循环
 *
 * @author lenovo
 * @version 1.0
 * @date 2023/5/20 10:15
 */

public class XunHuan {

    //结束一个循环有几个方法
    //break return结束方法 exception异常

    //结束当次循环 后面都不走
    //continue

    public static void for1(){
        for (int i = 0; i < 10; i++) {
            if(i==6){
                continue;
            }
            System.out.print(i + "\t");
        }
    }
    public static void for2(){
        y: for (int i = 0; i < 5; i++) {
            for (int i1 = 0, len = 10; i1 < len; i1++) {
                if (i1 == 6) {
                    //直接跳出最近的for循环
                    System.out.println();
                    continue y;
                    //throw new RuntimeException("error");
                }
                System.out.print(i1 + "\t");
            }

        }
    }

    public static void main(String[] args) {
        for2();
    }
}
